package com.yzr.direct;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.yzr.util.RabbitMqClient;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * 发布-订阅模型路由
 */
public class Producer {
    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitMqClient.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare("logs", BuiltinExchangeType.DIRECT);

        channel.basicPublish("logs","warn",null,"hello direct".getBytes());

        RabbitMqClient.close(channel,connection);
    }

}
